package com.qiangqiang.task.server.mapper;

import com.qiangqiang.task.server.entity.Post;
import com.qiangqiang.task.server.entity.Task;
import com.qiangqiang.task.server.mapper.provider.PostMapperProvider;
import com.qiangqiang.task.server.mapper.provider.TaskMapperProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @program: task
 * @description:
 * @author: Sky.lin
 * @create: 2018-12-20 19:58
 **/
@Mapper
public interface PostMapper {

    @InsertProvider(type = PostMapperProvider.class, method = "insertPost")
    int insertPost(@Param("post") Post post);

    @SelectProvider(type = PostMapperProvider.class, method = "queryAllPost")
    List<Post> queryAllPost(@Param("page") int page, @Param("pageSize") int pageSize);

    @Select("select * from post where publisher_id=#{userId}")
    List<Post> queryPostByUserId(@Param("userId") long userId);

    @Select("select * from post where post_id=#{postId}")
    Post queryPostByPostId(@Param("postId") long postId);
}
